#include <limits.h>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QyDebug.h>
#include <QpwDecorationObject.h>
#include "QpwSubType.h"

/**************************************************************************************************/

QpwSubType::QpwSubType( const QUuid & uuid ) : QpwXML::Row(uuid) {

    baseType = QpwWorld::DecorationObject::DecorationObjectType;
    objectFunction = None;
    health = 0;
    eventProcessorType = 0;
    destroyProcessorType = 0;
    linearDamping = 3.0;
    angularDamping = 3.0;
    density = 1.0;
    friction = 0.3;
    mass = 1.0;

}

QpwXML::Values QpwSubType::values() const {

    QpwXML::Values values;

    values["baseType"] = quint32(baseType);
    values["objectFunction"] = quint32(objectFunction);
    values["styleUuid"] = styleUuid.toString();
    values["name"] = name;
    values["description"] = description;
    values["health"] = health;
    values["geometry"] = geometryUuid.toString();
    values["eventProcessorType"] = eventProcessorType;
    values["destroyProcessorType"] = destroyProcessorType;
    values["linearDamping"] = linearDamping;
    values["angularDamping"] = angularDamping;
    values["density"] = density;
    values["friction"] = friction;
    values["mass"] = mass;

    return values;
}

void QpwSubType::setValues( const QpwXML::Values & values ) {

    baseType = QpwWorld::DecorationObject::ObjectTypes( values["baseType"].toUInt() );
    objectFunction = ObjectFunction( values["objectFunction"].toUInt() );
    styleUuid = values["styleUuid"].toString();
    name = values["name"].toString();
    description = values["description"].toString();
    health = values["health"].toUInt();
    geometryUuid = values["geometry"].toString();
    eventProcessorType = values["eventProcessorType"].toUInt();
    destroyProcessorType = values["destroyProcessorType"].toUInt();
    linearDamping = values["linearDamping"].toDouble();
    angularDamping = values["angularDamping"].toDouble();
    density = values["density"].toDouble();
    friction = values["friction"].toDouble();
    mass = values["mass"].toDouble();

}
